function  moments =  simulation_results_output_test( S, N_years,  output_file_name  )
% Usage:  simulation_results_output( S, N_years, output_file_name )
% This function generate simulation outputs to the output_file_name, which should be an excel file.
if(nargin<2)
    N_years = 4000;
end

par = S.model_sol.par;  
S.model_sol.par.eta = 0;
model_sol = post_processing(S.model_sol);    

shocks = shocks_generation( N_years,  par, 1);  
w_init = 0.2;  lambda_init = 0.1;
sim = simulate( w_init, lambda_init,  shocks.dB_vec, shocks.dN_vec,  N_years, model_sol,  par  );
[ rational_moments,  behavioral_moments ] = simulation_moments( sim, model_sol );

if( par.model_name=="behavioral" )
    moments = behavioral_moments;
else
    moments = rational_moments;
end

if(nargin>=3)
writetable(  moments.tbl_output, output_file_name,'Sheet', 1, 'WriteVariableNames',true); 
end